#include <iostream>
#include<string> 

using namespace std;

//string 求子串

void test09()
{
    string str = "abcdef";

    string subStr = str.substr(1, 3); 

    cout << "subStr = " << subStr << endl;
}

//实用操作
void test10()
{
    string email = "zhangsan@sina.com";

    //从邮件地址中 获取 用户名称

    int pos = email.find("@");
    cout << pos << endl;

    string usrName = email.substr(0, pos);
    cout << usrName << endl;
}

int main()
{
    test09();
    test10();

    return 0;
}
